package com.jackiechan.day12;

import java.io.*;

public class Test_OutStream {
    public static void main(String[] args) throws IOException {
        method();
        method1();
        System.out.println((int)('我'));
    }

    public static void method() throws IOException {
        // 第二参数默认为false,即改写,若改为true则为追加
        OutputStream out = new FileOutputStream(
                "D:\\test\\2.txt");
//        int i = 100;
        byte[] b = {'I',' ','a','m',' ','I','r','o','n',' ','m','a','n','!','\n'};
        out.write(b);
//        out.write(b,2,2);
//        out.write(100);
        out.close();
    }

    public static void method1() throws IOException {
        OutputStream out1 = new BufferedOutputStream(
                new FileOutputStream("D:\\test\\3.txt"));
        byte[] b1 = {73, 32, 108, 111, 118, 101, 32, 121, 111, 117, 10};
        out1.write(b1);
//        out1.write(b1,7,4);
//        out1.write(73);
        out1.close();
    }

}

